package com.jia.leetCode;

/**
 * LCP 07. 传递信息
 */
public class LCP07 {
    int count = 0;
    public int numWays(int n, int[][] relation, int k) {
        breaktrancing(0, 1, n, relation, k);
        return count;
    }
    private void breaktrancing(int start, int time, int n, int[][] relation, int k) {
        for(int i = 0; i < relation.length; i++) {
            if(relation[i][0] == start) {
                if(time == k) {
                    if(relation[i][1] == n - 1) {
                        ++count;
                    }
                }else {
                    breaktrancing(relation[i][1], time + 1, n, relation, k);
                }
            }
        }
    }
}
